//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2003 Intrinsyc Europe Ltd.
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2004 Siemens AG
//
// Version: 1.1.2.5
// Date:    11. Jan. 2006
//////////////////////////////////////////////////////////////////////////////


#pragma once

//
// Phonebook storage locations
//
static const LPCSTR g_rgszPBLocations[] =
{
    "",             // RIL_PBLOC_UNKNOWN
    "EN",           // RIL_PBLOC_SIMEMERGENCY
    "FD",           // RIL_PBLOC_SIMFIXDIALING
    "LD",           // RIL_PBLOC_SIMLASTDIALING
    "ON",           // RIL_PBLOC_OWNNUMBERS
    "SM",           // RIL_PBLOC_SIMPHONEBOOK
};
#define NUM_PBLOCS     (sizeof(g_rgszPBLocations) / sizeof(LPCSTR))


struct SUPPORTED_MODEM {
    char *szModem;
    DWORD dwType;
};


#define MISC_CMDBUF_LENGTH_PB    (MAX_ATCMD_LEN)
#define MISC_CMDBUF_LENGTH_COST  (MAX_ATCMD_LEN)
// We do not need these calculations: any string from or to the AT interface will not exceed MAX_ATCMD_LEN character
//#define MISC_CMDBUF_LENGTH_PB    (MAX_PATH + MAXLENGTH_ADDRESS + MAXLENGTH_PHONEBOOKTEXT)
//#define MISC_CMDBUF_LENGTH_COST  (2 * MAX_PATH + 3 * MAXLENGTH_PASSWORD + MAXLENGTH_CURRENCY)
#define MISC_ALLOC_NUMBER        16

HRESULT RILDrv_GetPhonebookOptions(DWORD dwParam);
HRESULT RILDrv_SetPhonebookOptions(DWORD dwParam, const RILPHONEBOOKINFO* lpPhonebookInfo);
HRESULT RILDrv_ReadPhonebookEntries(DWORD dwParam, DWORD dwStartIndex, DWORD dwEndIndex);
HRESULT RILDrv_WritePhonebookEntry(DWORD dwParam, const RILPHONEBOOKENTRY* lpEntry);
HRESULT RILDrv_DeletePhonebookEntry(DWORD dwParam, DWORD dwIndex);
HRESULT RILDrv_SendSimCmd(DWORD dwParam, const BYTE* lpbCommand, DWORD dwSize);
HRESULT RILDrv_SendRestrictedSimCmd(DWORD dwParam, DWORD dwCommand, const RILSIMCMDPARAMETERS* lpParameters,
                                    const BYTE* lpbData, DWORD dwSize);
HRESULT RILDrv_GetSimRecordStatus(DWORD dwParam, DWORD dwFileID);
HRESULT RILDrv_GetSimToolkitProfile(DWORD dwParam);
HRESULT RILDrv_SetSimToolkitProfile(DWORD dwParam, const BYTE* lpbProfile, DWORD dwSize);
#ifdef SIEMENS_MAGNETO
HRESULT RILDrv_SendSimToolkitCmdResponse(DWORD dwParam, const RILSIMTOOLKITRSP* pRsp, LPBYTE pDetails, const DWORD dwDetailSize);
HRESULT RILDrv_SendSimToolkitEventDownload(DWORD dwParam, const DWORD dwEvent, LPBYTE pData, const DWORD dwDataSize);
#else // SIEMENS_MAGNETO
HRESULT RILDrv_SendSimToolkitCmdResponse(DWORD dwParam, const BYTE* lpbResponse, DWORD dwSize);
HRESULT RILDrv_SendSimToolkitEnvelopeCmd(DWORD dwParam, const BYTE* lpbCommand, DWORD dwSize);
#endif // SIEMENS_MAGNETO
HRESULT RILDrv_TerminateSimToolkitSession(DWORD dwParam, DWORD dwCause);
HRESULT RILDrv_GetEquipmentInfo(DWORD dwParam);
HRESULT RILDrv_GetEquipmentState(DWORD dwParam);
HRESULT RILDrv_SetEquipmentState(DWORD dwParam, DWORD dwEquipmentState);
HRESULT RILDrv_GetCostInfo(DWORD dwParam);
HRESULT RILDrv_SetCostInfo(DWORD dwParam, const RILCOSTINFO* lpCostInfo, LPCSTR lpszPassword);
HRESULT RILDrv_GetSignalQuality(DWORD dwParam);
HRESULT RILDrv_GetCellTowerInfo(DWORD dwParam);
HRESULT RILDrv_DevSpecific(DWORD dwParam, const BYTE* lpbParams, DWORD dwSize);

HRESULT RILDrv_GetCurrentSystemType(DWORD dwParam);
HRESULT RILDrv_GetRoamingMode(DWORD dwParam);
HRESULT RILDrv_SetRoamingMode(DWORD dwParam, DWORD dwRoamingMode);
HRESULT RILDrv_GetPreferredPrivacyMode(DWORD dwParam);
HRESULT RILDrv_SetPreferredPrivacyMode(DWORD dwParam, DWORD dwPreferredPrivacyMode);
HRESULT RILDrv_GetCurrentPrivacyStatus(DWORD dwParam);
#if defined (IOCTL_RIL_GETANTENNASTATUS)
HRESULT RILDrv_GetAntennaStatus(DWORD dwParam);
#endif

void FillRSQStruct(RILSIGNALQUALITY* prsq);
void TraceDriverInfo(void);
void ClearFDPBCache();

HRESULT ParseGetPhonebookOptions(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
